import type { Key, PageDTO, PageRes, SortDTO } from '@/types/global'
import type { AddReport, Report, QueryReport, UpdateReport } from '@/types/report'
import { request } from '@/utils/request'

export function queryReportList(params: PageDTO & SortDTO & QueryReport) {
  return request.get<PageRes<Report>>('/api/report', { params })
}

export function addReport(data: AddReport) {
  return request.post('/api/report', data)
}

export function getReportById(id: number) {
  return request.get<Report>('/api/report/' + id)
}

export function updateReport(data: UpdateReport) {
  return request.put('/api/report', data)
}

export function deleteReportByIds(idList: Key[]) {
  return request.delete('/api/report', {
    params: {
      idList: idList
    }
  })
}
